<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* .box1{
            width: 500px;
            height: 100px;
            background-color: #;
        } */
    </style>
</head>
<body>
    <div class="box1">
        <button>点击换色</button>
    </div>
    <script>
        var box = document.getElementsByClassName('box1')
        box.onclick = function (){
            var res3 =''
            var res = Math.random()*17
           var res1 = parseInt(res)
           var res2 = res1.toString(16)
                res3 += res2
                console.log(res3);
        }
           

           
            
           
                
            
    
         
      
        
       
        
        
            
      
    </script>
</body>
</html>